package com.dodol.testcases;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;

import java.util.concurrent.TimeUnit;

/**
 * @Auther: 80736
 * @Date: 2018/9/6 17:25
 * @Description:
 */
public class BaseTestObject {

    private WebDriver webDriver;

    public WebDriver getWebDriver() {
        return webDriver;
    }


    @BeforeMethod
    public void setUp() {
        if (webDriver == null) {
            webDriver = new ChromeDriver();
            webDriver.manage().window().maximize();
            // 页面和元素超时时间
            webDriver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
            webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        }

    }

    @AfterClass
    public void tearDown() {
        webDriver.close();
    }
}
